<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Directory Selector Example</title>
</head>
<body>
    <input type="file" id="directoryInput" webkitdirectory directory multiple style="display:none;" onchange="handleDirectorySelect(this)">
    <button onclick="triggerDirectorySelect()">Select a Directory</button>

    <script>
        function triggerDirectorySelect() {
            document.getElementById('directoryInput').click();
        }

        function handleDirectorySelect(input) {
            const files = input.files;
            const directoryEntries = [];

            for (let i = 0; i < files.length; i++) {
                const file = files[i];
                // file.webkitRelativePath contains the relative path to the file within the selected directory
                directoryEntries.push(file.webkitRelativePath || file.name);
            }

            // Here you can process the directory entries as needed
            console.log('Selected directory entries:', directoryEntries);
            // For example, display them in the page or send them to a server
        }
    </script>
</body>
</html>